using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Xml;

public partial class taskdetails : System.Web.UI.Page
{
    String taskid = String.Empty;
    String targerdn = String.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        taskid = Request.QueryString["taskid"];
        targerdn = Request.QueryString["targetdn"];

        if (!IsPostBack)
        {
            getTask();
        }
    }

    private void getTask()
    {
        String getTaskRequest = RequestXML.getTask;

        XmlDocument xmldoc = new XmlDocument();
        xmldoc.LoadXml(getTaskRequest);
        xmldoc.SelectSingleNode(".//*[local-name()='TaskId']").InnerText=taskid;
        xmldoc.SelectSingleNode(".//*[local-name()='Target']").InnerText = targerdn;

        String getTaskResponse = Util.run(xmldoc.OuterXml);
        xmldoc.LoadXml(getTaskResponse);

        if (xmldoc.SelectSingleNode(".//*[local-name()='outputMsgFromUser']") != null)
        {
            TextBox1.Text = xmldoc.SelectSingleNode(".//*[local-name()='outputMsgFromUser']").InnerText;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.LoadXml(RequestXML.performTaskAction);
        xmldoc.SelectSingleNode(".//*[local-name()='TaskId']").InnerText = taskid;
        xmldoc.SelectSingleNode(".//*[local-name()='inputStatus']").InnerText = "Approved";
        Util.run(xmldoc.OuterXml);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.LoadXml(RequestXML.performTaskAction);
        xmldoc.SelectSingleNode(".//*[local-name()='TaskId']").InnerText = taskid;
        xmldoc.SelectSingleNode(".//*[local-name()='inputStatus']").InnerText = "Rejected";
        Util.run(xmldoc.OuterXml);
    }
}
